<@override name="content">

<div class="pagination pagination-centered">
  <ul>
    <li class="<#if logs.pageNumber==1>disabled</#if>">
    <a href="user/loginlog/1<#if logs.pageSize!=pageSize>-${logs.pageSize}</#if>">&lt;&lt;</a>
    </li> 
    <#if logs.pageNumber&gt;1>
    <li>
    <a href="user/loginlog/${logs.pageNumber-1}<#if logs.pageSize!=pageSize>-${logs.pageSize}</#if>">Prev</a>
    </li>
    </#if>
    <#if logs??> 
    <#assign start=logs.pageNumber-3> 
    <#assign end=logs.pageNumber+3> 
    <#if start<1><#assign end=end-start+1>
    <#assign start=1>
    </#if>
    <#if end&gt;logs.totalPage >
    <#assign start=start-(end-logs.totalPage)-1>
    <#if start<1><#assign start=1></#if>
    <#assign end=logs.totalPage>
    </#if>
    <#if end<start><#assign end=start></#if>
    <#list start..end as x>
    <li class="<#if x==logs.pageNumber>active</#if>">
    <a href="user/loginlog/${x}<#if logs.pageSize!=pageSize>-${logs.pageSize}</#if>">${x}</a>
    </li>
    </#list>
    </#if> 
    <#if logs.pageNumber<logs.totalPage>
    <li>
    <a href="user/loginlog/${logs.pageNumber+1}<#if logs.pageSize!=pageSize>-${logs.pageSize}</#if>">Next</a>
    </li>
    </#if>
    <li class="<#if logs.pageNumber&gt;=logs.totalPage>disabled</#if>">
    <a href="user/loginlog/${logs.totalPage}<#if logs.pageSize!=pageSize>-${logs.pageSize}</#if>">&gt;&gt;</a>
    </li>
  </ul>
  <div class="pull-right">
    <span class="badge badge-info">${logs.pageNumber}/${logs.totalPage} Pages</span> 
    <span class="badge badge-info">${logs.totalRow} Records</span>
  </div>
</div>

<table id="user-log" class="table table-hover table-condensed">
  <thead>
    <tr>
      <th>No.</th>
      <th>Uid</th>
      <th>Name</th>
      <th>IP</th>
      <th>Time</th>
      <th>Success</th>
    </tr>
  </thead>
  <tbody>
    <#if logs??> 
    <#list logs.list as log>
      <tr>
        <td>${log.num!1}</td>
        <td>${log.uid!0}</td>
        <td>${log.name!}</td>
        <td>${log.ip!}</td>
        <td class="timestamp" data="${log.ctime}"></td>
        <td>${log.success?string('true', 'false')}</td>
      </tr>
    </#list> 
    </#if>
  </tbody>
</table>

<script type="text/javascript" src="assets/js/placeholders.min.js"></script>

<link rel="stylesheet" href="assets/tablecloth/css/tablecloth.css">
<script src="assets/tablecloth/js/jquery.metadata.js"></script>
<script src="assets/tablecloth/js/jquery.tablecloth.js"></script>

<script type="text/javascript" charset="utf-8">
      $(document).ready(function() {
                
        $('.timestamp').each(function() {
          $(this).html(getLocalTime($(this).attr('data')));
        });
        
        $("#user-log").tablecloth({
          theme:"stats",
          condensed:true,
          sortable:false,
          striped:true,
          clean:true
        });
    });
    </script>

</@override>
<@override name="scripts">
</@override>
<@extends name="../common/_layout.html" />
